from django.http import HttpResponse
from common.models import Customer

def listcustomers(request):
    qs = Customer.objects.all() 
    ph = request.GET.get('phonenumber','')
    if ph:
        qs = qs.filter(phonenumber=ph)
    html = ''
    for customer in qs:
        html += f'<p>{customer.name}</p>'
        html += f'<p>{customer.phonenumber}</p>'
        html += f'<p>{customer.address}</p>'
        html += f'<p>{customer.qq}</p>'
    return HttpResponse(html)